import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import Home from '../views/Home.vue';
import Layout from '../components/Layout.vue';
import Grouping from '@/views/coupon/Grouping.vue';
import Coupon from '@/views/coupon/Index.vue';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/layout',
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: '/',
        redirect: '/index',
      },
      {
        path: '/index',
        name: '首页',
        component: Home,
      },
      {
        path: '/article',
        name: '文章管理',
        component: () => import('@/views/Content/Article/index.vue'),
        meta: {
          title: '文章管理',
        },
      },
      {
        path: '/carousel',
        name: '轮播管理',
        component: () => import('@/views/Content/Carousel/index.vue'),
        meta: {
          title: '轮播管理',
        },
      },
      {
        path: '/viplist',
        name: '会员列表',
        component: () => import('@/views/VipList.vue'),
        meta: {
          title: '会员管理',
        },
      },
      {
        path: '/grade',
        name: '会员等级',
        component: () => import('@/views/grade/Index.vue'),
        meta: {
          title: '会员列表',
        },
      },
      {
        path: '/gift',
        name: '开卡赠礼',
        component: () => import('@/views/Gift.vue'),
        meta: {
          title: '会员列表',
        },
      },
      {
        path: '/settings',
        name: '会员设置',
        component: () => import('@/views/EditMember.vue'),
        meta: {
          title: '会员设置',
        },
      },
      {
        path: '/coupon',
        name: '卡券管理',
        component: Coupon,
        children: [
          {
            path: 'group',
            name: '分组管理',
            component: Grouping,
          },
          {
            path: 'cancel',
            name: '卡券核销',
            component: () => import('@/views/coupon/Cancel.vue'),
          },
          {
            path: 'give',
            name: '转赠记录',
            component: () => import('@/views/coupon/Give.vue'),
          },
          {
            path: 'list',
            name: '卡券列表',
            component: () => import('@/views/coupon/List.vue'),
          },
          {
            path: 'member',
            name: '会员卡券',
            component: () => import('@/views/coupon/Member.vue'),
          },
          {
            path: 'publish',
            name: '发券记录',
            component: () => import('@/views/coupon/Publish.vue'),
          },
        ],
      },
      {
        path: '/merchant',
        name: '商品管理',
        component: () => import('@/views/StoreAdmin/Merchant/index.vue'),
        meta: {
          title: '文章管理',
        },
      },
      {
        path: '/storelist',
        name: '店铺列表',
        component: () => import('@/views/StoreAdmin/storelist/index.vue'),
        meta: {
          title: '文章管理',
        },
      },
      {
        path: '/stafflist',
        name: '员工列表',
        component: () => import('@/views/StoreAdmin/stafflist/index.vue'),
        meta: {
          title: '文章管理',
        },
      },
      {
        path: '/shangbiao/fenlei',
        name: '商品分类',
        component: () => import('@/views/shangbiao/fenlei.vue'),
      },
      {
        path: '/shangbiao',
        name: '商品列表',
        component: () => import('@/views/shangbiao/index.vue'),
      },
      {
        path: '/list',
        name: '订单列表',
        component: () => import('@/views/OrderList/list.vue'),
      },
      {
        path: '/message2',
        name: '信息模板',
        component: () => import('@/views/message/message2.vue'),
      },
      {
        path: '/message3',
        name: '已发短信',
        component: () => import('@/views/message/message3.vue'),
      },
    ],
  },
  {
    path: '/Login',
    component: () => import('@/views/Login.vue'),
  },
  {
    path: '/shop',
    component: () => import('@/views/shop.vue'),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
